package com.onlinelearn.userservice.feign;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

import java.util.Collections;
import java.util.List;

@FeignClient(name = "course-service", fallback = CourseServiceFallback.class)
public interface CourseServiceClient {
    @GetMapping("/courses/{courseId}/students")
    List<Long> getCourseStudentIds(@PathVariable Long courseId);

    @GetMapping("/courses/{courseId}")
    CourseDTO getCourseDetails(@PathVariable Long courseId);
}

@Component
class CourseServiceFallback implements CourseServiceClient {
    @Override
    public List<Long> getCourseStudentIds(Long courseId) {
        return Collections.emptyList();
    }

    @Override
    public CourseDTO getCourseDetails(Long courseId) {
        return null;
    }
} 